home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ For TASM / USRGUIDE.PAK / COMPROG.ASM < prev    next >
Assembly Source File  |  1996-02-21  |  1KB  |  44 lines

  1. ; Turbo Assembler example. Copyright (c) 1993 By Borland International, Inc.
  2.  
  3. ; COMPROG.ASM - Template for writing .COM files.
  4.  
  5. ; From the Turbo Assembler User's Guide, Appendix A.
  6.  
  7. P8086          ;select the processor
  8. MODEL TINY     ;always must be TINY model
  9.  
  10. DATASEG
  11.    ;<<Any initialized data is defined here>>
  12.  
  13. UDATASEG
  14.    ;<<Any uninitialized data is defined here>>
  15.  
  16.    ;<<Set up room for user stack, if default stack is not desired>>
  17.    DW 100H DUP (?)
  18. MyStack  LABEL WORD
  19.  
  20. CODESEG        ;this marks the start of executable code
  21.    STARTUPCODE
  22.    ;COM has all available memory allocated to it
  23.  
  24.    ;Stack is already set up to top of 64K segment
  25.    ;We can move it if we want using the following instruction:
  26.    MOV SP,OFFSET MyStack
  27.  
  28.    ;Now execute user code
  29.    ;The code can be placed here, but it looks better to call it.
  30.    ;DoIt returns the exit code in AL.
  31.    CALL DoIt
  32.  
  33.    ;Exit to DOS when complete
  34.    MOV AH,4CH
  35.    INT 21H
  36.    RET
  37.  
  38. DoIt PROC NEAR
  39.    ;<<Your code goes here>>
  40.    MOV AL,1
  41.    RET
  42. DoIt ENDP
  43. END
  44.